import useCreation from "@/hooks/useCreation";
import { Button } from "antd";
import React, { useState } from "react";

const UseCreation: React.FC = () => {
  const [, setFlag] = useState<boolean>(false);

  const getNowData = () => Math.random();

  const nowData = useCreation(() => getNowData(), []);

  return (
    <div style={{ padding: 50 }}>
      <p>正常的函数：{getNowData()}</p>
      <p>useCreation包裹后的：{nowData}</p>
      <Button type="primary" onClick={() => setFlag(v => !v)}>
        渲染
      </Button>
    </div>
  );
};
export default UseCreation;
